<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>指针思想</title>
</head>

<body>
  <script>
    var str = 'aaaabbbbccccccccdddde'
    var i = 0, j = 1, maxNum = 0, maxStr = ''
    while (i <= str.length - 1) {
      if (str[i] !== str[j]) {
        if (j - i > maxNum) {
          maxNum = j - i
          maxStr = str[i]
        }
        console.log('报！！！' + i + '和' + j + '之间的字符' + str[i] + '连续相同，出现了' + (j - i) + '次')
        i = j
      }
      j++
    }
    console.log('出现最多的字符是:'+maxStr)
  </script>
</body>

</html>